<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>魔方</title>
    <style> 
            * {
                margin: 0;
                padding: 0;
            }
        body {
            background-color: #ccc;
            perspective: -100px;
        }
        ul {
            position: relative;
            width: 500px;
            height: 500px;
          
            transform-style: preserve-3d;
            transform: rotate3d(1,1,0,60deg);
            animation: in 1s ease-in forwards ,zhuan 3s linear 1s 3 ,out 1s ease-in 12s forwards;
        }
        li {
            position: absolute;
            list-style: none;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            font-size: 50px;
            background-color: rgba(198, 60, 211, 0.963);
        }
        .m1 {
            transform: translateX(-250px) rotateY(-90deg);
            /* background-color: red; */
        }
        .m2 {transform: translateZ(-250px) rotateY(180deg);
            /* background-color: orange; */
        }
        .m3 {
            transform: translateY(-250px) rotateX(90deg);
            /* background-color: yellow; */
        }
        .m4 {
            transform: translateX(250px) rotateY(90deg);
            /* background-color: green; */
        }
        .m5 {
            transform: translateZ(250px);
            /* background-color: cyan; */
        }
        .m6 {
            transform: translateY(250px)  rotateX(-90deg);
            /* background-color: purple; */
        }
        @keyframes zhuan {
            0% {
               transform: translate3d(500px,0,0) rotate3d(1,1,0,0deg);
             }
            25% {
                transform: translate3d(1500px,0,0) rotate3d(1,1,0,360deg) 
            }
            50% {
                transform: translate3d(1500px,1000px,0) rotate3d(1,1,0,720deg);
            }
            75% {
                transform: translate3d(500px,1000px,0) rotate3d(1,1,0,1080deg);
            } 
            100% {
                transform: translate3d(500px,0,0) rotate3d(1,1,0,1440deg);
            }
        }
        @keyframes in {
            for{
                transform: translate(0px,0);
            }
            to{
                transform: translate(500px,0);
            }
        }
        @keyframes out {
            for{
                transform: translate(1000px,0px);
            }
            to{
                transform: translate(5500px,1000px);
            }
        }
         div {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            border: 1px solid #fff;
            background-color: #000;

        }
         li .one {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            width: 150px;
            height: 150px;
           
        }
        li .two {
            float: left;
            margin: 100px 200px 0 200px;
           
        }

        li .three {
            float: left;
            margin: 50px 200px 0 200px;
         
        }
        
        li .fore {
            float: left;
            margin: 100px 0px 0 100px;
         
        }
        li .five {
            float: left;
            margin: 100px 0px 0 100px;
            
        }
        li .six {
            float: left;
            margin: 50px 0px 0 100px;
           
        }
    </style>
</head>
<body>
    <ul>
        <li class="m1">
            <div class="one"></div>
        </li>
        <li class="m2">
            <div class="two"></div>
            <div class="two"></div>
        </li>
        <li class="m3">
            <div class="three"></div>
            <div class="three"></div>
            <div class="three"></div>
        </li>
        <li class="m4">
            <div class="fore"></div>
            <div class="fore"></div>
            <div class="fore"></div>
            <div class="fore"></div>
        </li>
        <li class="m5">
            <div class="five"></div>
            <div class="five"></div>
            <div class="five"></div>
            <div class="five"></div>
            <div class="one"></div>
        </li>
        <li class="m6">
            <div class="six"></div>
            <div class="six"></div>
            <div class="six"></div>
            <div class="six"></div>
            <div class="six"></div>
            <div class="six"></div>
        </li>
    </ul> 
</body>
</html>